#include "ustandard/ustandard_def.h"
int main()
{
    #define LEN 10

    if(1) {
        char s[LEN] ;
        memset(s, 'a', LEN);
        int n = snprintf(s, LEN, "%d%d", 123456, 123456);
        int eno = errno;
        printf("n=%d, s=%s, eno=%d\n", n, s, eno);
        printf("s tail : ");
        size_t len = strlen(s);
        int i;
        for(i=len; i<LEN; i++) {
            printf("%d", s[i]);
        }
        printf("\n");
    }

    if(1) {
        char s[LEN] ;
        memset(s, 'a', LEN);
        int n = snprintf(s, 6, "%d%d", 123456, 123456);
        int eno = errno;
        printf("n=%d, s=%s, eno=%d\n", n, s, eno);
        printf("s tail : ");
        size_t len = strlen(s);
        int i;
        for(i=len; i<LEN; i++) {
            printf("%d", s[i]);
        }
        printf("\n");
    }

    if(1) {
        char s[LEN] ;
        memset(s, 'a', LEN);
        int n = snprintf(s, 1, "%d%d", 123456, 123456);
        int eno = errno;
        printf("n=%d, s=%s, eno=%d\n", n, s, eno);
        printf("s tail : ");
        size_t len = strlen(s);
        int i;
        for(i=len; i<LEN; i++) {
            printf("%d", s[i]);
        }
        printf("\n");
    }

    if(1) {
        char s[LEN] ;
        memset(s, 'a', LEN);
        int n = snprintf(s, 0, "%d%d", 123456, 123456);
        int eno = errno;
        printf("n=%d, s=%s, eno=%d\n", n, s, eno);
        printf("s tail : ");
        size_t len = strlen(s);
        int i;
        for(i=len; i<LEN; i++) {
            printf("%d", s[i]);
        }
        printf("\n");
    }

    if(1) {
        char s[LEN] ;
        memset(s, 'a', LEN);
        int offset = 0;
        while(1) {
            int n = snprintf(s+offset, 6-offset, "%d%d", 123456, 123456);
            int eno = errno;
            printf("n=%d, s=%s, eno=%d\n", n, s, eno);
            printf("s tail : ");
            size_t len = strlen(s);
            int i;
            for(i=len; i<LEN; i++) {
                printf("%d", s[i]);
            }
            printf("\n");

            offset = strlen(s);
        }
    }




    return 0;
}
